extends layout

block content
  script(src='/socket.io/socket.io.js')
  script.
    var socket = io()
    socket.on("message", function(msg) {
      location.reload(true);
    })

  h3 Recent blocks
  table.table
    thead
      tr
        th Number
        th Timestamp
        th # Tx
        th # Uncles
    tbody
      for block in blocks
        tr
          td
            a(href="block/" + block.number) #{block.number}
          td #{moment(Number(block.timestampMS)).format("YYYY-MM-DD HH:mm:ss.SSSZ")}
          td #{block.transactions.length}
          td #{block.uncles.length}
  h3 Recent Transactions
  if txs.length === 0
    p No transactions during the last #{blockCount} blocks
  else
    table.table
      thead
        tr
          th Hash
          th From
          th To
          th Amount
      tbody
        for tx in txs
          tr
            td
              a(href="tx/" + tx.hash) #{tx.hash.substr(0,10)}...
            td
              a(href="account/" + tx.from) #{nameformatter.format(tx.from)}
            td
              if tx.to
                a(href="account/" + tx.to) #{nameformatter.format(tx.to)}
              else
                | New Contract
            td #{ethformatter(tx.value)}
